import java.util.Arrays;

public class ALG {
    public int[] moveZeroes(int[] nums) {
        for (int cur = 0, dest = -1; cur < nums.length; cur++) {
            if (nums[cur] != 0) {
                dest++;
                int tmep = nums[cur];
                nums[cur] = nums[dest];
                nums[dest] = tmep;
            }

        }
        return nums;
    }

    public static void main(String[] args) {
        ALG alg = new ALG();
        int[] nums = {0,1,3,4,0,12,44};
        System.out.println(Arrays.toString(alg.moveZeroes(nums)));


    }
}
